/*
 * @Copyright: Copyright (c) 2030 吴周海
 * @Author: wzh200x@126.com
 * @Date: 2025-10-09 16:00:14
 * @LastEditors: wzh200x@126.com
 * @LastEditTime: 2025-10-09 16:00:29
 * @FilePath: \goWebServer\goGameWebServer\internal\model\entity\baseModel.go
 * @Description: 文件功能描述
 */
package entity

import "goGameWebServer/internal/defines/dataType"

type BaseModel struct {
	Name       string
	EntityDBID dataType.TypeDataBaseId
	Template   interface{} // 数据模版,由子类设置
}

func (baseModel *BaseModel) Create() error {
	panic("BaseModel.Create() not implement")
}

func (baseModel *BaseModel) IsPersistent() bool {
	return true
}

func (baseModel *BaseModel) SetEntityDBID(entityDBID dataType.TypeDataBaseId) {
	baseModel.EntityDBID = entityDBID
}

func (baseModel *BaseModel) GetEntityDBID() dataType.TypeDataBaseId {
	return baseModel.EntityDBID
}

func (baseModel *BaseModel) SetTemplate(t interface{}) {
	baseModel.Template = t
}

func (baseModel *BaseModel) Reset() {
	baseModel.Name = ""
	baseModel.EntityDBID = 0
}

func NewBaseModel(name string, entityDBID dataType.TypeDataBaseId) BaseModel {
	return BaseModel{
		Name:       name,
		EntityDBID: entityDBID,
		Template:   nil,
	}
}
